package com.chuck.blogpro.mapper;

import org.apache.ibatis.annotations.*;

import com.chuck.blogpro.pojo.Tag;

import java.util.List;

/**
 * 直接在 mapper 中写 sql 语句；
 */
@Mapper
public interface TagMapper {

    @Insert("insert into t_tag(name) values(#{name})")
    void add(String name);

    @Delete("delete from t_tag where id=#{id}")
    void delete(Integer id);

    @Update("update t_tag set name=#{name} where id=#{id}")
    void update(Tag tag);

    @Select("select * from t_tag where id=#{id}")
    Tag getTag(Integer id);

    @Select("select * from t_tag")
    List<Tag> list();
}
